/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.webos.java.base.workspace;

import java.util.ArrayList;
import java.util.List;
import org.webos.java.base.Frame;

/**
 *
 * @author kostya
 */
public class FrameHolder extends WorkspaceItem{

    private List<String> frameCodes = new ArrayList<String>();
    private String activeFrame = null;
    private boolean locked = false;

    public FrameHolder(WorkspaceItem aParent) {
        super(aParent);
    }

    public FrameHolder(WorkspaceItem aParent, String aCode) {
        super(aParent, aCode);
    }

    public FrameHolder(WorkspaceItem aParent, String aCode, Frame aFrame) {
        super(aParent, aCode);
        addFrame(aFrame);
    }

    public List<String> getFrameCodes() {
        return frameCodes;
    }

    public void addFrame(Frame aFrame){
        String code = aFrame.isDynamic()?aFrame.getInstanceID():aFrame.getCode();
        if(!frameCodes.contains(code))
            frameCodes.add(code);
    }

    /**
     * @return the activeFrame
     */
    public String getActiveFrame() {
        return activeFrame;
    }

    /**
     * @param activeFrame the activeFrame to set
     */
    public void setActiveFrame(String activeFrame) {
        this.activeFrame = activeFrame;
    }

    /**
     * @return the locked
     */
    public boolean isLocked() {
        return locked;
    }

    /**
     * @param locked the locked to set
     */
    public void setLocked(boolean locked) {
        this.locked = locked;
    }
}
